package com.list;

import java.util.Comparator;

import com.root.Person;

public class PersonComparator implements Comparator<Person> {

	@Override
	public int compare(Person o1, Person o2) {

		if (Integer.valueOf(o1.getId()) > Integer.valueOf(o2.getId())) {

			// obj instanceof Student

			// compare based on student ID

			// obj instanceof Teacher

			// compare based on salary

			return 1;
		}

		if (Integer.valueOf(o1.getId()) < Integer.valueOf(o2.getId())) {
			return -1;
		}
		return 0;
	}

}
